package com.fastloan.mgt.model.model;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fastloan.mgt.model.service.GeneratorModelStrategy;

/**
 * 模型
 *
 * @author yanwe
 * createTime 2017-11-2017/11/10 11:28
 */
public class Model {

    private Integer modelId;

    private String modelName;

    @JsonIgnore
    private GeneratorModelStrategy modelHandler;

    public Integer getModelId() {
        return modelId;
    }

    public void setModelId(Integer modelId) {
        this.modelId = modelId;
    }

    public String getModelName() {
        return modelName;
    }

    public void setModelName(String modelName) {
        this.modelName = modelName;
    }

    public GeneratorModelStrategy getModelHandler() {
        return modelHandler;
    }

    public void setModelHandler(GeneratorModelStrategy modelHandler) {
        this.modelHandler = modelHandler;
    }

    public static final class ModelBuilder {
        private Integer modelId;
        private String modelName;
        private GeneratorModelStrategy modelHandler;

        private ModelBuilder() {
        }

        public static ModelBuilder aModel() {
            return new ModelBuilder();
        }

        public ModelBuilder withModelId(Integer modelId) {
            this.modelId = modelId;
            return this;
        }

        public ModelBuilder withModelName(String modelName) {
            this.modelName = modelName;
            return this;
        }

        public ModelBuilder withModelHandler(GeneratorModelStrategy modelHandler) {
            this.modelHandler = modelHandler;
            return this;
        }

        public Model build() {
            Model model = new Model();
            model.setModelId(modelId);
            model.setModelName(modelName);
            model.setModelHandler(modelHandler);
            return model;
        }
    }
}
